{% extends "./layout.html" %}
{% import "./includes/macros.html" as docmacro %}

{% block title %}{% parent %} &raquo; API{% endblock %}

{% block content %}
<h1>Swig API</h1>

{% for def in api %}
{% if def.kind === 'typedef' and def.undocumented !== true %}
  <section id="{{ def.name }}" class="doc">
    <h2>Object Type: {{ def.name }}</h2>
    {{ docmacro.source(def, 1) }}

    {{ docmacro.description(def) }}

    {% if def.properties.length %}
    <h3>Properties</h3>
    <table>
      <thead>
        <tr>
          <th>Name</th>
          <th>Type</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
      {% for prop in def.properties %}
        <tr>
          <td><var data-language="js">{{ prop.name }}</var></td>
          <td><code data-language="js">{{ prop.type|join(" or ") }}</code></td>
          <td>{{ prop.description|raw }}</td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    {% endif %}

    {% if def.examples.length %}
    <h3>Examples</h3>
    {% for example in def.examples %}
    <pre><code data-language="js">{{ example }}</code></pre>
    {% endfor %}
    {% endif %}
  </section>
{% endif %}
{% endfor %}

{% for prop in api %}
{% if prop.kind === 'member' and prop.undocumented !== true %}
  <section id="{{ prop.name }}" class="doc">
    <h2>swig.{{ prop.name }}</h2>
    {{ docmacro.source(prop, 1) }}

    {{ docmacro.description(prop) }}

    {% if prop.examples.length %}
    <h3>Examples</h3>
    {% for example in prop.examples %}
    <pre><code data-language="js">{{ example }}</code></pre>
    {% endfor %}
    {% endif %}
  </section>
{% endif %}
{% endfor %}

{% for fn in api %}
  {% if fn.access !== "private" and fn.kind === 'function' and fn.undocumented !== true %}
  <section id="{{ fn.name }}" class="doc">
    <h2>
      swig.{{ fn.name }}(
      {%- for p in fn.params -%}
      {{ p.name }}
      {%- if not loop.last %}, {% endif -%}
      {%- endfor -%}
      )
    </h2>

    {{ docmacro.source(fn, 1) }}

    {{ docmacro.description(fn) }}

    {% if fn.params.length %}
    <h3>Parameters</h3>
    <table>
      <thead>
        <tr>
          <th>Name</th>
          <th>Type</th>
          <th>Optional</th>
          <th>Default</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
      {% for param in fn.params %}
        <tr>
          <td><var data-language="js">{{ param.name }}</var></td>
          <td><code data-language="js">{{ param.type|join(" or ") }}</code></td>
          <td>{% if param.optional === true %}✔{% endif %}</td>
          <td><code data-language="js">{{ param.defaultvalue }}</code></td>
          <td>{{ param.description|raw }}</td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    {% endif %}

    {% if fn.returns %}
    <h3>Returns</h3>
    {% for ret in fn.returns %}
    <p><samp data-language="js">{{ ret.type.names|join(', ') }}</samp>: {{ ret.description|raw }}</p>
    {% endfor %}
    {% endif %}

    {% if fn.examples.length %}
    <h3>Examples</h3>
    {% for example in fn.examples %}
    <pre><code data-language="js">{{ example }}</code></pre>
    {% endfor %}
    {% endif %}
  </section>
  {% endif %}
{% endfor %}

{% endblock %}

{% block apisubnav %}
<ol>
{% for obj in api %}
{% if obj.access !== "private" and obj.undocumented !== true and obj.kind !== 'package' %}
  <li><a href="#{{ obj.name }}">{% if obj.kind === 'typedef' %}Object: {% elif obj.kind === 'function' or obj.kind === 'member' %}swig.{% endif %}{{ obj.name }}</a></li>
{% endif %}
{% endfor %}
</ol>
{% endblock %}
